package kr.or.javacafe.bigbaram;

public class Ant {

	private int n;
	private String disp;

	public Ant() {
		this(4);
	}

	public Ant(int n) {
		init(n);
	}

	public void init(int n) {
		this.n = n;
		disp = "11";

	}

	public void create() {
		String disp2 = "";
		String temp = "";
		int count = 0;
		for (int i = 1; i < n; i++) {
			print(i);
			temp = disp.substring(0,1);
			count = 1;
			for (int j = 1; j < disp.length(); j++) {
				if(!(disp.substring(j,j+1).equals(temp))){
					disp2 = disp2 + temp + Integer.toString(count);
					temp = disp.substring(j,j+1);
					count=1;
				}else{
					count++;
				}
			}
			disp = disp2 + temp + Integer.toString(count);
			disp2 = "";
		}
		print(n);
	}

	public void print(int n) {
		System.out.println("[" + n + "] \t" + disp );
	}

}
